package section_1;

import org.junit.Test;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * Created by asd73 on 2017/8/14.
 */
public class test1 {
    @Test
    public void circle(){
        int arr[][] = {{1,2,3},{4,5,6,7},{9}};
        boolean found  = false;
        for (int i=0;i<arr.length&&!found ;i++){
            for (int j =0;j<arr[i].length;j++){
                System.out.println("i="+i+"j="+j);
                System.out.println(arr[i][j]);
                if (arr[i][j]==5){
                    found=true;
                    break;
                }
            }
        }
    }

    @Test
    public void circle1(){
        ok:
        for(int i=0;i<10;i++)	{
            for(int j=0;j<10;j++)		{
                System.out.println("i=" + i + "j= "+ j);
                if(j == 5) break ok;
            }
        }

    }

    @Test
    public void switch1(){
        char a = 10;
        switch (a){
            case 10:
                System.out.println(true);
        }
        byte a1 = 10;
        switch (a1){
            case 10:
                System.out.println(true);
        }
        short a2 = 10;
        switch (a2){
            case 10:
                System.out.println(true);
        }
    }

    @Test
    public void method1(){
        short s1 = 1;
        s1+=1;
        System.out.println(s1);
    }

    @Test
    public void method7(){
        int a = 4<<3;
        System.out.println(a);
    }
    @Test
    public void method2(){
        final String a = "sdf";


    }
    @Test
    public void VariantTest(){
        String a = "abc";
        String b = "abv";
        if (a.equals(b)){
            System.out.println(1);
        }
    }

    @Test
    public void method4(){
        Map map = new HashMap();
        map.put(1,"");

    }

    @Test
    public void method5(){
        Map<Integer,String> map = new HashMap<>();
        map.put(1,"data1");
        map.put(2,"data2");
        map.get(1);
        Set<Map.Entry<Integer,String >> maps = map.entrySet();
        Iterator<Map.Entry<Integer,String >> iterator = maps.iterator();
        while (iterator.hasNext()){
            Map.Entry<Integer,String> map1 = iterator.next();
            System.out.println(map1.getKey()+":"+map1.getValue());
        }
    }

    @Test
    public void method6(){
        Integer a ;
        a=4%16;
        System.out.println(a);
    }
    @Test
    public void method8(){
        String s1 = "Programming";
        String s2 = new String("Programming");
        String s3 = "Program";
        String s4 = "ming";
        String s5 = "Program" + "ming";
        String s6 = s3 + s4;
        System.out.println(s1 == s2);
        System.out.println(s1 == s5);
        System.out.println(s1 == s6);
        System.out.println(s1 == s6.intern());
        System.out.println(s2 == s2.intern());
    }












}
